// Copyright (c) 1996-99 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
// and this paragraph appear in all copies. This software program and
// documentation are copyrighted by The Regents of the University of
// California. The software program and documentation are supplied "AS
// IS", without any accompanying services from The Regents. The Regents
// does not warrant that the operation of the program will be
// uninterrupted or error-free. The end-user understands that the program
// was developed for research purposes and is advised not to rely
// exclusively on the program for any reason. IN NO EVENT SHALL THE
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

package org.umlviewer.paint;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

public class ArrowHead {

    private int arrowWidth = 7;
    private int arrowHeight = 12;
    private Color fill, line;
    
    public ArrowHead()
    {
        
    }

    public ArrowHead(Color fill, Color line) {
        this.fill = fill;
        this.line = line;
    }
        
    
     public double dist(double dx, double dy) {
        return Math.sqrt(dx * dx + dy * dy);
    }

    public void setArrowHeight(int arrowHeight) {
        this.arrowHeight = arrowHeight;
    }

    public void setArrowWidth(int arrowWidth) {
        this.arrowWidth = arrowWidth;
    }         
     
     public int getWidth() {
        return arrowWidth;
    }

    public int getHeight() {
        return arrowHeight;
    } 
    
     /** return the approximate arc length of the path in pixel units */
    public int getLineLength(Point one, Point two) {
        int dxdx = (two.x - one.x) * (two.x - one.x);
        int dydy = (two.y - one.y) * (two.y - one.y);
        return (int) Math.sqrt(dxdx + dydy);
    }

    /** return a point that is dist pixels along the path */
    public Point pointAlongLine(Point one, Point two, int dist) {
        int len = getLineLength(one, two);
        int p = dist;
        if (len == 0) {
            return one;
        }
        return new Point(one.x + ((two.x - one.x) * p) / len, one.y
                + ((two.y - one.y) * p) / len);
    }         
    
     public void paint(
            final Graphics g,
            final Point start, 
            final Point end, 
            final Color lineColor, 
            final Color fillColor) {
     }     
}
